package com.qidian.tcba.oss.service;


import com.qidian.tcba.oss.model.dto.AttachmentResultDTO;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @author:fyl
 * @date 2021/7/14 9:45
 * @Modified By:
 * @Modified Date:
 * @Description:
 */

public interface AttachmentsService {
    AttachmentResultDTO upload(MultipartFile file,int ownerType, int ownerId,int businessType) throws IOException;

    /**
     * 批量上传
     * @param files
     * @return
     */
    List<AttachmentResultDTO> uploadBatch(MultipartFile[] files,int ownerType, int ownerId,int businessType);

    /**
     * 关联附件
     * @param ownerId
     * @param ownerName
     * @param ids
     * @return
     */
    int relateAttach(Integer ownerId, String ownerName,List<Integer> ids);

    /**
     * 通过业务类型查找附件
     * @param ownerType
     * @param ownerId
     * @param businessType
     * @return
     */
    List<AttachmentResultDTO> findByOwner(String ownerType,int ownerId, int businessType);

    int removeByOwner(Integer ownerId, String ownerName, String type);

    List<String> getPath(int ownerType, int ownerId,int businessType);

    boolean removeById(Integer id);
}
